pre_update_site_option_{$option}
Filter HookDescription
Filters a specific network option before its value is updated. The dynamic portion of the hook name, `$option`, refers to the option name.Hook Information
File Location |
wp-includes/option.php
View on GitHub
|
Hook Type | Filter |
Line Number | 2399 |
Hook Parameters
Type | Name | Description |
---|---|---|
mixed
|
$value
|
New value of the network option. |
mixed
|
$old_value
|
Old value of the network option. |
string
|
$option
|
Option name. |
int
|
$network_id
|
ID of the network. |
Usage Examples
Basic Usage
<?php
// Hook into pre_update_site_option_{$option}
add_filter('pre_update_site_option_{$option}', 'my_custom_filter', 10, 4);
function my_custom_filter($value, $old_value, $option, $network_id) {
// Your custom filtering logic here
return $value;
}
Source Code Context
wp-includes/option.php:2399
- How this hook is used in WordPress core
<?php
2394 * @param mixed $value New value of the network option.
2395 * @param mixed $old_value Old value of the network option.
2396 * @param string $option Option name.
2397 * @param int $network_id ID of the network.
2398 */
2399 $value = apply_filters( "pre_update_site_option_{$option}", $value, $old_value, $option, $network_id );
2400
2401 /*
2402 * If the new and old values are the same, no need to update.
2403 *
2404 * Unserialized values will be adequate in most cases. If the unserialized
PHP Documentation
<?php
/**
* Filters a specific network option before its value is updated.
*
* The dynamic portion of the hook name, `$option`, refers to the option name.
*
* @since 2.9.0 As 'pre_update_site_option_' . $key
* @since 3.0.0
* @since 4.4.0 The `$option` parameter was added.
* @since 4.7.0 The `$network_id` parameter was added.
*
* @param mixed $value New value of the network option.
* @param mixed $old_value Old value of the network option.
* @param string $option Option name.
* @param int $network_id ID of the network.
*/
Quick Info
- Hook Type: Filter
- Parameters: 4
- File: wp-includes/option.php
Related Hooks
Related hooks will be displayed here in future updates.